package top.rainf.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.rainf.domain.vo.City;
import top.rainf.mapper.CityMapper;
import top.rainf.service.ICityService;

import java.util.List;

/**
 * @author 星环
 * @date Wed May 10 21:04:41 CST 2023
 * @description City服务的实现类
 */
@Service
public class CityService implements ICityService {

    @Autowired
    CityMapper cityMapper;

    @Override
    public List<City> getCityList() {
        return cityMapper.selectAll();
    }



    @Override
    public City getOneById(int id) {
        return cityMapper.selectById(id);
    }

    @Override
    public boolean deleteOneById(int id) {
        return cityMapper.deleteById(id) == 1;
    }

    @Override
    public boolean deleteAll(List<Integer> idList) {
        return cityMapper.deleteByIds(idList) == idList.size();
    }

    @Override
    public boolean updateById(City city) {
        return cityMapper.updateById(city) == 1;
    }

    @Override
    public List<City> getCityList(Integer id) {
        return cityMapper.selectByProvinceId(id);
    }
}
